package com.hxkj.dao.impl;

import com.hxkj.dao.AuthUserRoleAppDao;
import com.hxkj.domain.po.AuthRole;
import com.hxkj.mapper.AuthUserRoleAppMapper;
import com.hxkj.domain.po.AuthUserRoleApp;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;


/**
* 数据操作实现
*
* @author: chenwei
* @version: 1.0
* @datetime: 2018-05-21 17:59:26
*
*/
@Service("authUserRoleAppDao")
public class AuthUserRoleAppDaoImpl implements AuthUserRoleAppDao {

    @Resource
    private AuthUserRoleAppMapper authUserRoleAppMapper;

    @Override
    public AuthUserRoleApp get(Long id) {
        return authUserRoleAppMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<AuthUserRoleApp> get(AuthUserRoleApp authUserRoleApp) {
        return authUserRoleAppMapper.select(authUserRoleApp);
    }

    @Override
    public int delete(Long id) {
        return authUserRoleAppMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int delete(AuthUserRoleApp authUserRoleApp) {
        return authUserRoleAppMapper.delete(authUserRoleApp);
    }

    @Override
    public int deleteUserRoleAppByRoleId(Long roleId) {
        return authUserRoleAppMapper.deleteUserRoleAppByRoleId(roleId);
    }

    @Override
    public int save(AuthUserRoleApp authUserRoleApp) {
        return authUserRoleAppMapper.insert(authUserRoleApp);
    }

    @Override
    public int update(AuthUserRoleApp authUserRoleApp) {
        return authUserRoleAppMapper.update(authUserRoleApp);
    }

    @Override
    public int deleteUserRoleByUserId(AuthUserRoleApp authUserRoleApp) {
        return authUserRoleAppMapper.deleteUserRoleByUserId(authUserRoleApp);
    }

    /**
    * @author Mr.zheng
    * @Description saveAuthUserRole 将用户ID和角色ID存入关联表
    * @Date 17:17 2018/6/1
    * @Param [authRole]
    * @return int
    **/
    @Override
    public int saveAuthUserRole(AuthUserRoleApp authUserRoleApp) {
        return authUserRoleAppMapper.saveAuthUserRole(authUserRoleApp);
    }
}
